﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php 
include("../inc/global.inc");
$type = (intval($_GET['type'])) ? 1 : 3;
$title = (intval($_GET['type'])) ? '买家注册' : '企业注册';

if($_POST['act2']=="sandi2012")
{
    if(strpos($_SERVER['HTTP_REFERER'],SITE_URL."join/")!==false)
	{
	   if(isset($_SESSION["chkCode"]) && $_SESSION['chkCode']==$_POST['c_code'])
	   {
	    $where = ($_POST['m_types']==1) ? "m_user='".$_POST['m_userid']."'" : "m_user='".$_POST['m_userid']."' or m_cname='".$_POST['m_company']."'";
		if(!$_POST[m_company])$_POST[m_company]=$_POST[m_people];
		$sql="select id from member where $where";
		
		$rs=mysql_query($sql);
		$row=mysql_fetch_array($rs);
		if(!$row['id'])
		{
		   if($_POST[c_provinces]&&$_POST[c_city]){
			$c_rs=mysql_query("select * from city where id='$_POST[c_provinces]' and city_id=0");
			$c_row=mysql_fetch_array($c_rs);
			$c_rs2=mysql_query("select * from city where id='$_POST[c_city]' and city_id>0");
			$c_row2=mysql_fetch_array($c_rs2);
			$c_rs3=mysql_query("select * from city where id='$_POST[c_diqu]' and city_id>0");
			$c_row3=mysql_fetch_array($c_rs3);
			$c_diqu=($_POST[c_diqu])?$_POST[c_diqu]:0;
			$pwd=$_POST[m_password];
			$psw=substr(md5($_POST[m_password]),7,19);
			$tel=$_POST[phone_country]."-".$_POST[phone_area]."-".$_POST[phone_number];
			$ip=get_client_ip();
			
			$_uid=$db->query("insert into member (m_mode,m_type,m_user,m_psw,m_psw2,m_name,m_sex,m_cname,m_email,m_pro,pro,m_city,city,m_diqu,diqu,m_addre,m_tel,m_phone,m_qq,m_addtime,m_endtime,m_ip,a_fb) values ('$_POST[m_mode]','$_POST[m_types]','$_POST[m_userid]','$psw','$pwd','$_POST[m_people]','$_POST[m_sex]','$_POST[m_company]','$_POST[m_email]','$_POST[c_provinces]','$c_row[city_name]','$_POST[c_city]','$c_row2[city_name]','$c_diqu','$c_row3[city_name]','$_POST[addres]','$tel','$_POST[m_mobile]','$_POST[m_qq]','".date("Y-m-d H:i:s")."','".date("Y-m-d H:i:s")."','$ip','1')");
			$content=iconv("utf-8","gb2312","<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN' 'http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd'>
	<HTML xmlns='http://www.w3.org/1999/xhtml'>
	<HEAD>
	<TITLE>会员注册三帝贸易网</TITLE>
	<META http-equiv=Content-Type content='text/html; charset=gb2312'>
	<style type='text/css'>
	<!--
	body {
		margin-left: 0px;
		margin-top: 0px;
		margin-right: 0px;
		margin-bottom: 0px;
		font-size: 12px;
		FONT-FAMILY: Verdana, Arial, Helvetica, sans-serif;
		background-color: #FFFFFF;
	}
	a:link {
		color: #003399;
		text-decoration: underline;
	}
	a:hover {
		color: #FF6600;
		text-decoration: underline;
	}
	a:active {
		color: #003399;
		text-decoration: underline;
	}
	a:visited {
		color: #003399;
		text-decoration: underline;
	}
	
	
	
	#mail {
		padding: 0px;
		width: 622px;
		margin-top: 0px;
		margin-right: auto;
		margin-bottom: 0px;
		margin-left: auto;
		border-right-width: 1px;
		border-left-width: 1px;
		border-right-style: solid;
		border-left-style: solid;
		border-right-color: #ECE9D8;
		border-left-color: #ECE9D8;
	}
	#mail .info .to {
		line-height: 22px;
	}
	
	#mail .info .title {
		font-family: Arial;
		font-size: 19px;
		padding: 5px;
		background-color: #EBEBEB;
	}
	
	#mail .logo {
		float: left;
		padding-top: 13px;
	}
	#mail .headbg {
		float: right;
	}
	#mail .info {
		padding: 10px;
	}
	#mail .info .note {
		background-color: #ECF3FB;
		padding: 5px;
		line-height: 18px;
	}
	
	#mail .foot {
		background-color: #7EB1DA;
		padding: 6px;
	
		text-align: right;
	}
	
	.onl {
		clear: both;
	}
	-->
	</style>
	</HEAD>
	<BODY>
	<div id='mail'>
	<div class='logo'><img src='http://www.sandib2b.cn/images/logo.gif' width='388' height='60'></div>
	<div class='headbg'><img src='http://www.sandib2b.cn/images/headbg.gif' width='220' height='75'></div>
	<div class='onl'></div>
	<table width='100%' border='0' cellpadding='0' cellspacing='0'>
	  <tr>
		<td height='42' align='right' valign='bottom' background='http://www.sandib2b.cn/images/webbg.gif'><img src='http://www.sandib2b.cn/images/messbg.gif' width='257' height='28'></td>
		</tr>
	</table>
	<div class='info'>
		<table cellspacing='0' cellpadding='0' width='100%' align='center' border='0'>
		<tbody>
		  <tr>
			<td width='593' height='300' valign='top'><div><strong>您好 "."$_POST[m_people]"."("."$_POST[m_sex]".")</strong>
					<div class='to'>用户名:"."$_POST[m_userid]"."<br>
					  密码:$_POST[m_password]<br>
					  您已经成功注册三帝贸易网会员.<br>现在您可以登录完善您的企业信息和发布您的供求信息<br>登陆:<a href='http://www.sandib2b.cn/login/'>http://www.sandib2b.cn/login/</a><br><BR>
					  <br>
					  <BR>
					  <br>
					  <BR>
					  <br>
					  <A href='http://www.sandib2b.cn/' target='_blank'>http://www.sandib2b.cn</A>
					  <BR>
					  <br>
					  警告：系统邮件请勿回复！
					</div>
			  </div>
			  </td>
		  </tr>
		</tbody>
	  </table>
	</div>
	<div class='foot'>国内专业网上商品贸易平台<font color='#CC0000'>三帝贸易网</font></div>
	</div>
	</BODY>
	</HTML>");
	
			  
			  $setcookie["user_id"]=$_uid;
			  $setcookie["user_name"]=$_POST['m_userid'];
			  $setcookie["user_type"]=$_POST['m_types'];
			  set_cookie($var, $setcookie, 2592000);
			  @sendmail($_POST['m_email'],"会员注册三帝贸易网",$content);
			  echo "<script>alert('注册成功');location='/member/';</script>";exit;
			  
			}else
			{
				
				echo "<script>alert('请选择省份和城市');location='javascript:history.go(-1)';</script>";exit;
			}
		}
			else
			{
					   
					   echo "<script>alert('该账号或公司已经存在');location='javascript:history.go(-1)';</script>";exit;
			}
		}
		else
		{
		   echo "<script>alert('验证码错误');location='javascript:history.go(-1)';</script>";exit;
		}
	}
	else
	{
		echo "<script>location='/';<script>";exit;
	}
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo $title;?>-三帝贸易网</title>
<link href="/css/body.css" rel="stylesheet" type="text/css" />
<link href="/css/head_2.css" rel="stylesheet" type="text/css" />
<link href="/css/foot.css" rel="stylesheet" type="text/css" />
<link href="css/join.css" rel="stylesheet" type="text/css" />
<script language="javascript" src="js/join.js" type="text/javascript" charset="gb2312"></script>
<script language="javascript" src="/js/city.js" type="text/javascript" charset="gb2312"></script>
<style type="text/css">
<!--
.STYLE1 {color: #FF0000}
-->
</style>
</head>
<body>
<?php include("../inc/head_top.php")?>
<div class="top1 topside6">
<div style="float:left;width:388px;"><a href="/"><img src="/images/logo.gif" border="0"/></a></div>
<div class="onl"></div>
</div>
<div class="onl"></div>
<div id="mian" class="topside6 sideyellow1">
<div style="margin-bottom:10px; margin-top:10px;">
<script type="text/javascript">
/*800*45，创建于2013-7-18*/
var cpro_id = "u1322706";
</script>
<script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script>
</div>
<form method="post" action="index.php" onsubmit="return checkform()" name="form1">
<input type="hidden" name="m_types" value="<?php echo $type;?>" />
<input type="hidden" name="m_mode" value="1" />
<div class="title3 size12">尊敬的新会员您好，欢迎您注册三帝贸易网！
  <div class="onl"></div>
</div>
<div class="content size14">
 <?php if($type==3){?>
  <table width="100%" border="0" cellpadding="0" cellspacing="0">
    <tr>
      <td valign="top" bgcolor="#F4F4F0" style="line-height:20px; padding-left:15px;"><strong>企业注册：</strong><br />
        <span style="line-height:20px;">1.发布商品信息；&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;      2.发布招聘信息；  3.发布展会信息；  4.发布招标信息；<br />
        5.发布代理加盟信息；  6.发布贷款信息；  7.发布批发商品；  8.建立自己的企业商铺。</span></td>
      </tr>
  </table>
  <?php }?>
  <table width="100%" height="112" border="0" cellpadding="0" cellspacing="0" class="table">
    <tbody>
      <tr>
        <td width="20%" height="28" align="right" bgcolor="#F4F4F0">注册会员类型<span class="fontred"> *</span></td>
        <td height="28" colspan="2" bgcolor="#F4F4F0"><?php if($type==3){?><a href="index.php"><input type="radio" checked="checked" onClick="window.open('index.php','_self')"/>企业注册</a><?php }else{?>买家注册（该账户只提供买家交易用，不可以发布商品信息）<?php }?></td>
      </tr>
      <tr>
        <td width="20%" height="28" align="right" >会员登录名<span class="fontred"> * </span></td>
        <td width="42%" height="28" ><input name="m_userid" type="text" class="input1" id="m_userid" size="35" maxlength="40" onChange="callServer();"/>&nbsp;<span id="test1"></span></td>
        <td width="38%" ><div class="txt">会员登录名由6-20个英文字母或数字组成(不支持中文)。一旦注册成功，不可修改。</div></td>
      </tr>
      <tr>
        <td width="20%" height="28" align="right" bgcolor="#F4F4F0" >密　　码<span class="fontred"> *</span></td>
        <td width="42%" height="28" bgcolor="#F4F4F0">
		<input name="m_password" type="password" class="input1" id="m_password" size="35" maxlength="40" /></td>
        <td width="38%" height="28" bgcolor="#F4F4F0"><div class="txt">密码由6以上字符组成，建议采用易记、难猜的英文数字组合。</div></td>
      </tr>
      <tr>
        <td width="20%" height="28" align="right" >确认密码<span class="fontred"> *</span></td>
        <td width="42%" height="28" ><input name="m_password2" type="password" class="input1" id="m_password2" size="35" maxlength="40" /></td>
        <td width="38%" height="28" ><div class="txt">请再输入一遍您上面填写的密码。</div></td>
      </tr>
    </tbody>
  </table>
  <div class="title2 b">姓名和联系方式</div>
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
    <tbody>
      <tr>
        <td width="20%" align="right" bgcolor="#F4F4F0" ><span class="text">真实姓名</span><span class="fontred"> *</span></td>
        <td width="42%" bgcolor="#F4F4F0"><input name="m_people" class="input1" id="m_people" size="35" /></td>
        <td width="38%" bgcolor="#F4F4F0"><div class="txt">请输入全名</div></td>
      </tr>
      <tr>
        <td width="20%" align="right" ><span class="text">称呼</span><span class="fontred"> *</span></td>
        <td colspan="2" >
		 <input id="m_sex" name="m_sex" type="radio" value="先生" checked="checked"> 先生
		 <input id="m_sex" name="m_sex" type="radio" value="女士"> 女士
		 <input id="m_sex" name="m_sex" type="radio" value="小姐"> 小姐</td>
      </tr>
      <tr>
        <td width="20%" align="right" bgcolor="#F4F4F0" ><span class="text">电子邮箱<span class="fontred"> *</span></span></td>
        <td bgcolor="#F4F4F0" ><input name="m_email" class="input" id="m_email" size="35" /></td>
        <td bgcolor="#F4F4F0" ><div class="txt">非常重要！</div></td>
      </tr>
      <?php if($type==3){?>
      <tr>
        <td align="right" >贵公司名称<span class="fontred"> *</span></td>
        <td ><input name="m_company" class="input" id="m_company" size="35" /></td>
        <td >&nbsp;</td>
      </tr>
      <?php }?>
      <tr>
        <td align="right" bgcolor="#F4F4F0" ><span class="text"><?php if($type==3){?>公司所在地<?php }else{?>您的所在地<?php }?></span><span class="fontred"> *</span></td>
        <td colspan="2" bgcolor="#F4F4F0" >
		<select  name="c_provinces" id="c_provinces" onChange="changecity(document.form1.c_provinces.options[document.form1.c_provinces.selectedIndex].value)">
            <option value="">--选择省份--</option>
          <?php
          $result = mysql_query("select * from city where city_id=0");    
          while($res = mysql_fetch_array($result)){    
          ?>    
          <option value="<?=$res['id']?>"><?=$res['city_name']?></option> 
          <?php }?>   
       </select>
       <select name="c_city" id="c_city" onChange="changecity2(document.form1.c_city.options[document.form1.c_city.selectedIndex].value)">
            <option value="">--选择城市--</option>
       </select>
	   <select name="c_diqu" id="c_diqu">
            <option value="">--选择地区--</option>
       </select></td>
        </tr>
	  <tr>
        <td width="20%" align="right" ><span class="text">联系地址</span><span class="fontred"> *</span></td>
        <td colspan="2" ><input name="addres" id="addres" type="text" class="input" maxlength="100"/></td>
      </tr>
      <tr>
        <td width="20%" align="right" bgcolor="#F4F4F0" ><span class="text">固定电话<span class="fontred"> *</span></span></td>
        <td colspan="2" bgcolor="#F4F4F0">国家区号&nbsp;地区区号&nbsp;电话号码<br />
            <input class="input2" id="phone_country" maxLength="8" size="5" value="86" name="phone_country"> 
            <input class="input2" id="phone_area" maxLength="8" size="5" name="phone_area"> 
            <input class="input1" id="phone_number" maxLength="100" size="17" name="phone_number">
            <br /></td>
      </tr>
      <tr>
        <td width="20%" align="right" ><span class="text">手机<span class="fontred"> *</span></span></td>
        <td ><input name="m_mobile" class="input" id="m_mobile" size="35" /></td>
        <td  style="color:#FF0000"><?php if($type==3){?>手机号码可以免费接收询价短信提醒<?php }else{?>非常重要!<?php }?></td>
      </tr> 
      <tr>
        <td width="20%" align="right" bgcolor="#F4F4F0" ><span class="text">Q Q :&nbsp;&nbsp;</span></td>
        <td bgcolor="#F4F4F0" ><input name="m_qq" class="input" id="m_qq" size="35" /></td>
        <td bgcolor="#F4F4F0" ><div class="txt">只填写QQ号码</div></td>
      </tr>
      <tr>
        <td align="right" >验证码<span class="fontred"> *</span></td>
        <td colspan="2" ><input name="c_code" class="input2" id="c_code" size="8" maxlength="6" />&nbsp;<img src="/inc/chk_num.php" name="img" align="absmiddle" id="img"/>&nbsp;<a href="#" name="test" id="test">看不清楚？</a></td>
        </tr>
    </tbody>
  </table>
  <table width="100%" border="0" cellpadding="0" cellspacing="0" class="table">
    <tbody>
      <tr>
        <td colspan="3" align="center" ><div class="content">  <span class="fontgreen"><a 
class="news_trade" href="/about/fuwu.php" 
target="_blank">点此阅读三帝贸易网会员服务条款</a></span><br />
          <input type="hidden" name="act2" value="sandi2012" />
                <input name="Submit" type="submit" class="inputbutt" value="同意服务条款，提交注册信息" />
                <br /><span class="fontgray" style="display:none">如果您不能正常注册，请点此下载文档，我们帮您注册。</span><br />
                <?php if($type==3){?>
                <span class="STYLE1">友情提示</span>：您提交注册信息后，及时登录会员后台请在【企业商铺管理】里正确完善您的《企业信息管理》和《会员信息》资料！
<br />或者您的账号将会禁止使用，谢谢您的配合！
				<?php }?>
        </div></td>
      </tr>
    </tbody>
  </table>
</div>
</form>
    <div style="margin-bottom:10px; margin-top:10px;">
        <script type="text/javascript">
    /*800*90，注册页创建于2013-7-18*/
    var cpro_id = "u1322621";
    </script>
    <script src="http://cpro.baidustatic.com/cpro/ui/c.js" type="text/javascript"></script>
    </div>
</div>
<?php include("../inc/foot.php");?>
</body>
</html>
<script type="text/javascript" src="<?php echo SITE_URL;?>js/jquery.js"></script>
<script language="javascript">
var str = p1=p2=p3='';
$(function(){
	$('#c_provinces').change(function(){
		p1=$(this).children('option:selected').text();//这就是selected的值 
	})
	$('#c_city').change(function(){
		p2=$(this).children('option:selected').text();//这就是selected的值 
		str =p1+p2;  
		$('#addres').val(str);
	})
	$('#c_diqu').change(function(){
		p3=$(this).children('option:selected').text();//这就是selected的值 
		str =p1+p2+p3;  
		$('#addres').val(str);
	})
	
});
function $$(id){
return document.getElementById(id);
}
function checkform(){

 if($$("m_userid").value.length>30||$$("m_userid").value.length<6){
    alert("请按照要求输入会员登录名");
    $$("m_userid").focus();
    return false;
 }
 
 
if($$("m_userid").value!="")
 	 {
 	  	var temp = unisch($$("m_userid").value)
		if(temp==true)
		{
		    alert("请使用数字、字母，或数字字母组合");
			$$("m_userid").focus();
			return false;
		}
 	 }

	 
 if($$("m_password").value.length<6){
    alert("请输入密码");
    $$("m_password").focus();
    return false;
 }

if($$("m_password2").value!=$$("m_password").value){
alert("您两次输入的密码不一致");
$$("m_password2").focus();
return false;
}


if($$("m_people").value==""){
alert("请输入您的真实姓名");
$$("m_people").focus();
return false;
}

var pattern = /^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-])+/;
　　　　if(!pattern.test($$("m_email").value)){
			alert("请输入您的E-mail地址");
			$$("m_email").focus();
			return false;
		}
<?php if($type==3){?>
if($$("m_company").value==""){
alert("请输入您的公司名称");
$$("m_company").focus();
return false;
}
<?php }?>
if($$("c_provinces").value==""){
alert("请选择您的省份");
$$("c_provinces").focus();
return false;
}

if($$("c_city").value==""){
alert("请选择您的城市");
$$("c_city").focus();
return false;
}



if($$("addres").value==""){
alert("请输入联系地址");
$$("addres").focus();
return false;
}

if($$("phone_area").value==""){
alert("请输入地区区号");
$$("phone_area").focus();
return false;
}

if($$("phone_number").value==""){
alert("请输入电话号码");
$$("phone_number").focus();
return false;
}

if($$("m_mobile").value==""){
alert("请输入手机号码");
$$("m_mobile").focus();
return false;
}

if($$("c_code").value.length==""){
  alert("请输入您的验证码");
  $$("c_code").focus();
  return false;
}

}

function unisch(String) 
{ 
	var Letters = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"; 
	var i; 
	var c; 
	for( i = 0; i < String.length; i ++ ) 
	{ 
		c = String.charAt( i ); 
		if (Letters.indexOf( c ) ==-1) 
		{ 
			return true; 
		} 
	} 
	return false; 
} 

function test(img){
    var src=img.getAttribute("src");
    src=src+"?new="+Math.random(0,10);
    img.setAttribute("src",src);
}
function prepare(){
    var nav=document.getElementById("test");
    var name=nav.getAttribute("name");
    var str="test";
    if(name==str){
        nav.onclick=function(){
            var img=document.getElementById("img");
            test(img);
            return false;
        }
    }
}
window.onload=prepare;
/*120*270，创建于2011-3-23*/
var cpro_id = "u419785";
</script>
<script src="http://cpro.baidustatic.com/cpro/ui/f.js" type="text/javascript"></script>